import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // 图标 svg图标  早期浏览器对svg支持程度不一样
import '@/permission' // permission control
// 将request方法，挂载到原型
import request from './utils/request'
// import pageTools from '@/components/pageTools'
// Vue.component('pageTools', pageTools)
import mycomponents from '@/components/mycomponent'
Vue.use(mycomponents)
// 导入自定义指令
import * as directives from '@/directives'
Vue.prototype.$request = request
// 自定义指令图片
// 导入处理时间文件
import * as filters from '@/filters'
import Print from 'vue-print-nb'
Vue.use(Print)
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false
// ===========================for in 方法
// for (const k in directives) {
//   // console.log(k)
//   // console.log(directives[k])
//   Vue.directive(k, directives[k])
// }
// 处理指令
Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})
// 处理时间
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
// console.log(Object.keys(directives))
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
